#include "observer.h"

using namespace std;

int main(int argc, char *argv[])
{
    Blackboard *blackboard = new Blackboard();
    Student    *student1   = new Student("李雷", *blackboard);
    Student    *student2   = new Student("韩梅梅", *blackboard);

    // 黑板写下消息
    blackboard->writeMessage("Hey, bro!");

    // 李雷从观察者列表移除自己
    student1->removeObserver();
    blackboard->writeMessage("Yo, man!");

    // 韩梅梅从观察者列表移除自己
    student2->removeObserver();
    blackboard->writeMessage("Yeah, baby!");

    return 0;
}